<%@page import="mall.bean.Category"%>
<%@page import="mall.service.impl.CategoryServiceImpl"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	request.setCharacterEncoding("UTF-8");
	// 取表单数据
	String categoryName = request.getParameter("categoryName");
	String parentId = request.getParameter("parentId");
	String sortValue = request.getParameter("sortValue");
	String level = request.getParameter("level");
	// 保存到数据库
	Category obj = new Category();
	obj.setName(categoryName);
	obj.setParentId(Long.parseLong(parentId));
	obj.setParent(false);
	obj.setSort(Integer.parseInt(sortValue));
	obj.setLevel(Integer.parseInt(level));
	CategoryServiceImpl service = new CategoryServiceImpl();
	service.save(obj);
	// 跳转回列表页
	response.sendRedirect("category-list.jsp");
	
%>    
